load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "copr",
    srcs = [
        "batch_coprocessor.go",
        "batch_request_sender.go",
        "coprocessor.go",
        "coprocessor_cache.go",
        "key_ranges.go",
        "mpp.go",
        "mpp_probe.go",
        "region_cache.go",
        "store.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/store/copr",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/config",
        "//pkg/ddl/placement",
        "//pkg/domain/infosync",
        "//pkg/domain/resourcegroup",
        "//pkg/errno",
        "//pkg/kv",
        "//pkg/metrics",
        "//pkg/parser/terror",
        "//pkg/sessionctx/variable",
        "//pkg/store/copr/metrics",
        "//pkg/store/driver/backoff",
        "//pkg/store/driver/error",
        "//pkg/store/driver/options",
        "//pkg/util",
        "//pkg/util/execdetails",
        "//pkg/util/intest",
        "//pkg/util/logutil",
        "//pkg/util/memory",
        "//pkg/util/paging",
        "//pkg/util/tiflash",
        "//pkg/util/tiflashcompute",
        "//pkg/util/tracing",
        "//pkg/util/trxevents",
        "@com_github_dgraph_io_ristretto//:ristretto",
        "@com_github_gogo_protobuf//proto",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/coprocessor",
        "@com_github_pingcap_kvproto//pkg/errorpb",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_pingcap_kvproto//pkg/metapb",
        "@com_github_pingcap_kvproto//pkg/mpp",
        "@com_github_pingcap_log//:log",
        "@com_github_pingcap_tipb//go-tipb",
        "@com_github_tikv_client_go_v2//config",
        "@com_github_tikv_client_go_v2//error",
        "@com_github_tikv_client_go_v2//metrics",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//tikvrpc",
        "@com_github_tikv_client_go_v2//tikvrpc/interceptor",
        "@com_github_tikv_client_go_v2//txnkv/txnlock",
        "@com_github_tikv_client_go_v2//txnkv/txnsnapshot",
        "@com_github_tikv_client_go_v2//util",
        "@com_github_tikv_pd_client//:client",
        "@com_github_twmb_murmur3//:murmur3",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//status",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "copr_test",
    timeout = "short",
    srcs = [
        "batch_coprocessor_test.go",
        "coprocessor_cache_test.go",
        "coprocessor_test.go",
        "key_ranges_test.go",
        "main_test.go",
        "mpp_probe_test.go",
    ],
    embed = [":copr"],
    flaky = True,
    race = "on",
    shard_count = 29,
    deps = [
        "//pkg/kv",
        "//pkg/store/driver/backoff",
        "//pkg/testkit/testsetup",
        "//pkg/util/logutil",
        "//pkg/util/paging",
        "//pkg/util/trxevents",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_kvproto//pkg/coprocessor",
        "@com_github_pingcap_kvproto//pkg/mpp",
        "@com_github_stathat_consistent//:consistent",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//config",
        "@com_github_tikv_client_go_v2//testutils",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//tikvrpc",
        "@org_uber_go_goleak//:goleak",
        "@org_uber_go_zap//:zap",
    ],
)
